package xin.pdf;

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.FontFactory;
import com.itextpdf.text.pdf.BaseFont;

import java.io.IOException;

/**
 * <pre>
 * pdf 使用常量 包括字体等
 * </pre>
 *
 * @author 马老七
 * @version 1.0
 * @since 2019/3/27
 */
public class PdfFont {
    static {
        try {
            /**
             * BaseFont.createFont("字体参数",字体编码格式,是否将字体信息嵌入到pdf中,一般不需要嵌入)
             */
            CONTEXT_FONT = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H",BaseFont.NOT_EMBEDDED),
                    12f,
                    Font.NORMAL,
                    BaseColor.BLACK);
            TIMES_ROMAN = new Font(BaseFont.createFont(
                    BaseFont.TIMES_ROMAN,
                    "Cp1252", BaseFont.NOT_EMBEDDED),
                    14f,
                    Font.NORMAL,
                    BaseColor.BLACK);
            TITLE_FONT = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    22f,
                    Font.BOLD,
                    BaseColor.BLACK);

            TH_FONT = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    14f,
                    Font.NORMAL,
                    BaseColor.BLACK);
            MAR_FONT = BaseFont.createFont(
                    BaseFont.HELVETICA,
                    BaseFont.WINANSI,
                    BaseFont.NOT_EMBEDDED);
            NORMAL = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    12f,
                    Font.NORMAL,
                    BaseColor.BLACK);
            BOLD = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    12f,
                    Font.BOLD,
                    BaseColor.BLACK);
            ITALIC = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    12f,
                    Font.ITALIC,
                    BaseColor.BLACK);
            UNDERLINE = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    12f,
                    Font.UNDERLINE,
                    BaseColor.BLACK);
            STRIKETHRU = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    12f,
                    Font.STRIKETHRU ,//Font.ITALIC| Font.STRIKETHRU,
                    BaseColor.BLACK);
            BOLDITALIC = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    12f,
                    Font.BOLDITALIC,
                    BaseColor.BLACK);
            UNDEFINED = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    12f,
                    Font.UNDEFINED,
                    BaseColor.BLACK);
            RISE = new Font(BaseFont.createFont(
                    "STSongStd-Light",
                    "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED),
                    6f,
                    Font.NORMAL,
                    BaseColor.BLACK);

        } catch (DocumentException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 标题 - 宋体 二号 － 22 加粗
     */
    public static  Font TITLE_FONT;
    /**
     * 英文 - TIMES_ROMAN
     */
    public static Font TIMES_ROMAN;
    /**
     * 正文 - 宋体 小四 － 12
     */
    public static  Font CONTEXT_FONT;
    /**
     *  表头 - 宋体 四号 －14
     */
    public static  Font TH_FONT;
    /**
     * 水印 - Helvetica
     */
    public static  BaseFont MAR_FONT;



    /**
     * 正常字体
     */
    public static  Font NORMAL;
    /**
     *  加粗
     */
    public static  Font BOLD;
    /**
     * 斜体
     */
    public static  Font ITALIC;
    /**
     * 下划线
     */
    public static  Font UNDERLINE;
    /**
     * 中划线-删除线
     */
    public static  Font STRIKETHRU;
    /**
     * 加粗斜体
     */
    public static  Font BOLDITALIC;
    /**
     * 未定义
     */
    public static  Font UNDEFINED;

    /**
     * 上标/下标
     */
    public static  Font RISE;

}
